package com.bungarus.busi;

import com.bungarus.model.Member;
import com.bungarus.model.MemberRepository;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * Created by tang on 2018/11/11.
 */
@Component
public class LocalLogin implements Login {
    private static Logger logger = Logger.getLogger(LocalLogin.class);

    private MemberRepository repository;

    @Autowired
    public LocalLogin(MemberRepository repository) {
        this.repository = repository;
    }

    @Override
    public Member login(String username, String pwd, String tenantId) {
        return repository.findByAccountNameAndPasswordAndTenantId(username, pwd, tenantId);
    }

    @Override
    public Member auth(String token, String username, String tenantId) {
        return null;
    }
}
